import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Task {

    public static void main(String[] args) {

        final String fileName = "lesson9/task8/resource/book.txt";
        readFile(fileName);

    }

    public static void readFile(String fileName) {
        try(FileReader fr = new FileReader(fileName)){

            char[] buffer = new char[1024];
            int count = 0;
            while ((count = fr.read(buffer)) != -1) {
                System.out.print(new String(buffer, 0, count));
            }
            System.out.println();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}